#-*- coding:utf-8 -*-
# from steam_data_collect.settings import CONCURRENT_ITEMS
import datetime
import os
CONCURRENT_ITEMS=100
__author__ = 'root'
from peewee import Model,CharField,TextField,DateTimeField,ForeignKeyField,IntegerField
from playhouse.pool import PooledSqliteExtDatabase
db = PooledSqliteExtDatabase(
    os.path.join(os.path.dirname(__file__),'db.sqlite3'),
    # '/home/jack/kkk/db.sqlite3',   #测试环境
    # '/home/scrapy_projects/db.sqlite3',  #生产环境
    max_connections=50+CONCURRENT_ITEMS,
    stale_timeout=300)  # 5 minutes

class BaseModel(Model):
    class Meta:
        database = db



class rule_infos(BaseModel):

    url=TextField()
    class_title=TextField(default=u'',help_text=u'课堂标题规则')
    class_desc=TextField(default=u'',help_text=u'课堂简介规则')
    class_img=TextField(default=u'',help_text=u'课堂简介图片规则')
    challenge_title=TextField(default=u'',help_text=u'挑战名字')
    challenge_desc=TextField(default=u'',help_text=u'挑战简介')

    objective=TextField(default=u'',help_text=u'目标的规则')
    background_information=TextField(default=u'',help_text=u'背景信息的规则')

    science_skills=TextField(default=u'',help_text=u'科学类')
    technology_skills=TextField(default=u'',help_text=u'技术类')
    engineering_skills=TextField(default=u'',help_text=u'工程类')
    arts_skills=TextField(default=u'',help_text=u'艺术类')
    math_skills=TextField(default=u'',help_text=u'数学类')

    directions=TextField(default=u'',help_text=u'挑战方向')
    materials=TextField(default=u'',help_text=u'所需材料')
    wrap_up=TextField(default=u'',help_text=u'总结')

    extended_picture=TextField(default=u'',help_text=u'扩展图片')
    achievements_picture=TextField(default=u'',help_text=u'成果样例图片')


    class Meta:
        db_table = 'rule_infos'


class brainpop_rule_infos(BaseModel):

    url=TextField()
    class_title=TextField(default=u'',help_text=u'课堂标题规则')
    class_desc=TextField(default=u'',help_text=u'课堂简介规则')
    class_img=TextField(default=u'',help_text=u'课堂简介图片规则')
    challenge_title=TextField(default=u'',help_text=u'挑战名字')
    challenge_desc=TextField(default=u'',help_text=u'挑战简介')

    objective=TextField(default=u'',help_text=u'目标的规则')
    background_information=TextField(default=u'',help_text=u'背景信息的规则')

    science_skills=TextField(default=u'',help_text=u'科学类')
    technology_skills=TextField(default=u'',help_text=u'技术类')
    engineering_skills=TextField(default=u'',help_text=u'工程类')
    arts_skills=TextField(default=u'',help_text=u'艺术类')
    math_skills=TextField(default=u'',help_text=u'数学类')

    directions=TextField(default=u'',help_text=u'挑战方向')
    materials=TextField(default=u'',help_text=u'所需材料')
    wrap_up=TextField(default=u'',help_text=u'总结')

    extended_content=TextField(default=u'',help_text=u'扩展说明')
    extended_picture=TextField(default=u'',help_text=u'扩展图片')
    achievements_picture=TextField(default=u'',help_text=u'成果样例图片')


    class Meta:
        db_table = 'brainpop_rule_infos'


class nasa_rule_infos(BaseModel):

    url=TextField()
    class_title=TextField(default=u'',help_text=u'课堂标题规则')
    class_desc=TextField(default=u'',help_text=u'课堂简介规则')
    class_img=TextField(default=u'',help_text=u'课堂简介图片规则')
    challenge_title=TextField(default=u'',help_text=u'挑战名字')
    challenge_desc=TextField(default=u'',help_text=u'挑战简介')

    objective=TextField(default=u'',help_text=u'目标的规则')
    background_information=TextField(default=u'',help_text=u'背景信息的规则')

    science_skills=TextField(default=u'',help_text=u'科学类')
    technology_skills=TextField(default=u'',help_text=u'技术类')
    engineering_skills=TextField(default=u'',help_text=u'工程类')
    arts_skills=TextField(default=u'',help_text=u'艺术类')
    math_skills=TextField(default=u'',help_text=u'数学类')

    directions=TextField(default=u'',help_text=u'挑战方向')
    materials=TextField(default=u'',help_text=u'所需材料')
    wrap_up=TextField(default=u'',help_text=u'总结')

    extended_content=TextField(default=u'',help_text=u'扩展说明')
    extended_picture=TextField(default=u'',help_text=u'扩展图片')
    achievements_picture=TextField(default=u'',help_text=u'成果样例图片')


    class Meta:
        db_table = 'nasa_rule_infos'


if __name__ == '__main__':
    db.connect()
    db.create_tables([brainpop_rule_infos])
    db.close()